# import time
#
# print(time.strftime('%H:%M:%S'))
# print(time.ctime())
# print(time.gmtime())
# print(time.gmtime())
# print(time.strftime('%Y年%m月%d日 %H:%M:%S'))

# 时间标准库 datetime

# from datetime import date
#
# d = date(2025, 5, 27)
# print(d)
# # 获取当前日前
# d_today = date.today()
# print(d_today)
# # 得到date的元组对象
# # t_today = date.timetuple()
# # print(t_today)
# # 得到周几
# w_day = d.weekday()
# print(w_day)
# # 得到年份 第几周 周几
# c_day = d.isocalendar()
# print(c_day)
# print(d.strftime('%Y年%m月%d日'))

# from datetime import timedelta, datetime
#
# td = timedelta(days=2,hours=3)
# print(td)
#
# # 在现在的时间基础尚 往后两天
# dt = datetime.now() + timedelta(days=2)
# print(dt)
#
# # 在现在的时间基础尚 往前两天
# bt = datetime.now() - timedelta(days=2)
# print(bt)


from datetime import date, datetime,timedelta

# 输入一天 算出是当年的第几天
# input_str = input('请输入一个日期：')
# d = datetime.strptime(input_str, '%Y-%m-%d')
# # 方法一
# days = d.strftime('%j')
# print(f'{input_str}是{d.year}年中的第{days}天')
#
# # 方法二
# days2 = d.timetuple().tm_yday
# print(f'{input_str}是{d.year}年中的第{days2}天')

# 求出上个月的最后一天时间  -- 当前月的一号减一天
d = date.today()
result = date(year=d.year, month=d.month, day=1) # 当月一号
print(result)
last_day = result - timedelta(days=1)
print(last_day)

